#include "AIP_wait.h"
#include "../../game_engine.h"

#include <cmath>

AIP_wait::AIP_wait(clock_t now,clock_t dur):
AI_package(), initialTime( now ), duration( dur ){
    type = AIPT_wait;
    printf("Wait %d\n",duration);
}

void AIP_wait::AI_exec(character* ch, clock_t now){

    if( status != AIS_running ) return;

    if( now >= initialTime + duration ){
        status = AIS_finished;
    }

}

float AIP_wait::getProgress(character* ch, clock_t now){
    return float(now - initialTime)/float(duration);
}

